/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * JPnlAccordionFinalSignal.java
 *
 * Created on 07/03/2010, 18:17:14
 */
package systole.view.accordion;

import org.jdesktop.application.Action;
import systole.view.tabs.controllers.AnalysisController;

/**
 *
 * @author jmj
 */
public class JPnlAccordionFinalSignal extends javax.swing.JPanel {

    /**
     *
     */
    private static final long serialVersionUID = 8122753916739349249L;
    private AnalysisController analysisControl;

    /** Creates new form JPnlAccordionFinalSignal 
     * @param logic
     */
    public JPnlAccordionFinalSignal(AnalysisController logic) {
        initComponents();
        this.analysisControl = logic;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        btnShowSummary = new javax.swing.JButton();
        btnSegments = new javax.swing.JButton();
        btnShowMeanSegment = new javax.swing.JButton();
        btnShowDerivatives = new javax.swing.JButton();
        btnShowParams = new javax.swing.JButton();

        setName("Form"); // NOI18N
        setPreferredSize(new java.awt.Dimension(140, 223));
        setRequestFocusEnabled(false);

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(systole.view.SystoleApp.class).getContext().getActionMap(JPnlAccordionFinalSignal.class, this);
        btnShowSummary.setAction(actionMap.get("showSummary")); // NOI18N
        btnShowSummary.setFont(btnShowSummary.getFont().deriveFont(btnShowSummary.getFont().getSize()-2f));
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(systole.view.SystoleApp.class).getContext().getResourceMap(JPnlAccordionFinalSignal.class);
        btnShowSummary.setIcon(resourceMap.getIcon("btnShowSummary.icon")); // NOI18N
        btnShowSummary.setText(resourceMap.getString("btnShowSummary.text")); // NOI18N
        btnShowSummary.setToolTipText(resourceMap.getString("btnShowSummary.toolTipText")); // NOI18N
        btnShowSummary.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        btnShowSummary.setMaximumSize(new java.awt.Dimension(120, 35));
        btnShowSummary.setMinimumSize(new java.awt.Dimension(0, 0));
        btnShowSummary.setName("btnShowSummary"); // NOI18N
        btnShowSummary.setNextFocusableComponent(btnShowDerivatives);
        btnShowSummary.setPreferredSize(new java.awt.Dimension(120, 35));
        btnShowSummary.setVerifyInputWhenFocusTarget(false);
        btnShowSummary.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                btnShowSummaryFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                btnShowSummaryFocusLost(evt);
            }
        });
        add(btnShowSummary);

        btnSegments.setAction(actionMap.get("showOverlayedSegments")); // NOI18N
        btnSegments.setFont(btnSegments.getFont().deriveFont(btnSegments.getFont().getSize()-2f));
        btnSegments.setIcon(resourceMap.getIcon("btnSegments.icon")); // NOI18N
        btnSegments.setText(resourceMap.getString("btnSegments.text")); // NOI18N
        btnSegments.setToolTipText(resourceMap.getString("btnSegments.toolTipText")); // NOI18N
        btnSegments.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        btnSegments.setMaximumSize(new java.awt.Dimension(120, 35));
        btnSegments.setMinimumSize(new java.awt.Dimension(0, 0));
        btnSegments.setName("btnSegments"); // NOI18N
        btnSegments.setPreferredSize(new java.awt.Dimension(120, 35));
        btnSegments.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                btnSegmentsFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                btnSegmentsFocusLost(evt);
            }
        });
        add(btnSegments);

        btnShowMeanSegment.setAction(actionMap.get("showMeanSegment")); // NOI18N
        btnShowMeanSegment.setFont(btnShowMeanSegment.getFont().deriveFont(btnShowMeanSegment.getFont().getSize()-2f));
        btnShowMeanSegment.setIcon(resourceMap.getIcon("btnShowMeanSegment.icon")); // NOI18N
        btnShowMeanSegment.setText(resourceMap.getString("btnShowMeanSegment.text")); // NOI18N
        btnShowMeanSegment.setToolTipText(resourceMap.getString("btnShowMeanSegment.toolTipText")); // NOI18N
        btnShowMeanSegment.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        btnShowMeanSegment.setMaximumSize(new java.awt.Dimension(120, 35));
        btnShowMeanSegment.setMinimumSize(new java.awt.Dimension(0, 0));
        btnShowMeanSegment.setName("btnShowMeanSegment"); // NOI18N
        btnShowMeanSegment.setNextFocusableComponent(btnShowParams);
        btnShowMeanSegment.setPreferredSize(new java.awt.Dimension(120, 35));
        btnShowMeanSegment.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                btnShowMeanSegmentFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                btnShowMeanSegmentFocusLost(evt);
            }
        });
        add(btnShowMeanSegment);

        btnShowDerivatives.setAction(actionMap.get("showDerivatives")); // NOI18N
        btnShowDerivatives.setFont(btnShowDerivatives.getFont().deriveFont(btnShowDerivatives.getFont().getSize()-2f));
        btnShowDerivatives.setIcon(resourceMap.getIcon("btnShowDerivatives.icon")); // NOI18N
        btnShowDerivatives.setText(resourceMap.getString("btnShowDerivatives.text")); // NOI18N
        btnShowDerivatives.setToolTipText(resourceMap.getString("btnShowDerivatives.toolTipText")); // NOI18N
        btnShowDerivatives.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        btnShowDerivatives.setMaximumSize(new java.awt.Dimension(120, 35));
        btnShowDerivatives.setMinimumSize(new java.awt.Dimension(0, 0));
        btnShowDerivatives.setName("btnShowDerivatives"); // NOI18N
        btnShowDerivatives.setNextFocusableComponent(btnShowMeanSegment);
        btnShowDerivatives.setPreferredSize(new java.awt.Dimension(120, 35));
        btnShowDerivatives.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                btnShowDerivativesFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                btnShowDerivativesFocusLost(evt);
            }
        });
        add(btnShowDerivatives);

        btnShowParams.setAction(actionMap.get("showParameters")); // NOI18N
        btnShowParams.setFont(btnShowParams.getFont().deriveFont(btnShowParams.getFont().getSize()-2f));
        btnShowParams.setIcon(resourceMap.getIcon("btnShowParams.icon")); // NOI18N
        btnShowParams.setText(resourceMap.getString("btnShowParams.text")); // NOI18N
        btnShowParams.setToolTipText(resourceMap.getString("btnShowParams.toolTipText")); // NOI18N
        btnShowParams.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        btnShowParams.setMaximumSize(new java.awt.Dimension(120, 35));
        btnShowParams.setMinimumSize(new java.awt.Dimension(0, 0));
        btnShowParams.setName("btnShowParams"); // NOI18N
        btnShowParams.setPreferredSize(new java.awt.Dimension(120, 35));
        btnShowParams.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                btnShowParamsFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                btnShowParamsFocusLost(evt);
            }
        });
        add(btnShowParams);
    }// </editor-fold>//GEN-END:initComponents

    private void btnShowSummaryFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_btnShowSummaryFocusGained
        ButtonHighlighter.highlight(btnShowSummary);
    }//GEN-LAST:event_btnShowSummaryFocusGained

    private void btnShowSummaryFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_btnShowSummaryFocusLost
        ButtonHighlighter.unhighlight(btnShowSummary);
    }//GEN-LAST:event_btnShowSummaryFocusLost

    private void btnSegmentsFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_btnSegmentsFocusGained
        ButtonHighlighter.highlight(btnSegments);
    }//GEN-LAST:event_btnSegmentsFocusGained

    private void btnSegmentsFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_btnSegmentsFocusLost
          ButtonHighlighter.unhighlight(btnSegments);
    }//GEN-LAST:event_btnSegmentsFocusLost

    private void btnShowDerivativesFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_btnShowDerivativesFocusGained
        ButtonHighlighter.highlight(btnShowDerivatives);
    }//GEN-LAST:event_btnShowDerivativesFocusGained

    private void btnShowDerivativesFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_btnShowDerivativesFocusLost
          ButtonHighlighter.unhighlight(btnShowDerivatives);
    }//GEN-LAST:event_btnShowDerivativesFocusLost

    private void btnShowMeanSegmentFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_btnShowMeanSegmentFocusGained
        ButtonHighlighter.highlight(btnShowMeanSegment);
    }//GEN-LAST:event_btnShowMeanSegmentFocusGained

    private void btnShowMeanSegmentFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_btnShowMeanSegmentFocusLost
        ButtonHighlighter.unhighlight(btnShowMeanSegment);
    }//GEN-LAST:event_btnShowMeanSegmentFocusLost

    private void btnShowParamsFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_btnShowParamsFocusGained
         ButtonHighlighter.highlight(btnShowParams);
    }//GEN-LAST:event_btnShowParamsFocusGained

    private void btnShowParamsFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_btnShowParamsFocusLost
        ButtonHighlighter.unhighlight(btnShowParams);
    }//GEN-LAST:event_btnShowParamsFocusLost

    /**
     * Action to show summary
     */
    @Action
    public void showSummary() {
        if (this.analysisControl.isAnalysisProcessed()) {
            this.analysisControl.getFrmAnalysis().getFinalSignalPnl().showPanel("Summary");
        }
    }

    /**
     * Action to show derivatives 
     */
    @Action
    public void showDerivatives() {
        if (this.analysisControl.isAnalysisProcessed()) {
            this.analysisControl.getFrmAnalysis().getFinalSignalPnl().showPanel("Derivatives");
        }
    }

    /**
     * Action to show mean segment
     */
    @Action
    public void showMeanSegment() {
        if (this.analysisControl.isAnalysisProcessed()) {
            this.analysisControl.getFrmAnalysis().getFinalSignalPnl().showPanel("FinalSegment");
        }
    }

    @Action
    public void showOverlayedSegments(){
        if (this.analysisControl.isAnalysisProcessed()) {
            this.analysisControl.getFrmAnalysis().getFinalSignalPnl().showPanel("Overlayed");
        }
    }

    /**
     * Action to show parameters
     */
    @Action
    public void showParameters() {
        if (this.analysisControl.isAnalysisProcessed()) {
            this.analysisControl.getFrmAnalysis().getFinalSignalPnl().showPanel("Params");
        }
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnSegments;
    private javax.swing.JButton btnShowDerivatives;
    private javax.swing.JButton btnShowMeanSegment;
    private javax.swing.JButton btnShowParams;
    private javax.swing.JButton btnShowSummary;
    // End of variables declaration//GEN-END:variables
}
